{% extends 'PortalContraCulturaBundle::base.html.twig' %}

{% block content %}
	<script>
		$(function(){
			$('#contraculturabundle_usuario_password_first').attr('required',false);
			$('#contraculturabundle_usuario_password_second').attr('required',false);
		});
	</script>
	<div class="breadcrumbs" id="breadcrumbs">
		<ul class="breadcrumb">
			<li>
				<i class="icon-home home-icon"></i>
				<a href="{{ path('contracultura_index') }}">Início</a>
				<span class="divider">
					<i class="icon-angle-right arrow-icon"></i>
				</span>
			</li>
			<li>
				<a href='{{ path('contracultura_user_index') }}'>Usuários</a>
				<span class="divider">
					<i class="icon-angle-right arrow-icon"></i>
				</span>
			</li>
			<li class="active">
				{% if user.id > 0 %}
					Alterar Usuário
				{% else %}
					Incluir usuário
				{% endif %}
			</li>
		</ul><!--.breadcrumb-->						
	</div>
	<div class="page-content">
		<div class="row-fluid">
			<div class="span12">
			    <div class="page-header position-relative">
					<h1>
						{% if user.id > 0 %}
							Alterar Usuário
						{% else %}
							Incluir usuário
						{% endif %}
					</h1>
				</div><!--/.page-header-->
				    
			    <form class="form-horizontal" action="{{ path('contracultura_user_save') }}" method="post" >
					{{ form_widget(form.id) }}
					
					<div class="control-group">
						<label class="control-label" for="form-field-1">Login:</label>
						<div class="controls">
							{{ form_widget(form.username, {'attr': {'class': 'form-control', 'id' : 'form-field-1'}}) }}
						</div>
					</div>		
					<div class="control-group">			
						<label class="control-label" for="form-field-1">Senha:</label>
						<div class="controls">{{ form_widget(form.password.first) }}</div>
					</div>				
					<div class="control-group">			
						<label class="control-label" for="form-field-1">Confirmar Senha:</label>
						<div class="controls">{{ form_widget(form.password.second) }}</div>
					</div>				
					<div class="control-group">			
						<label class="control-label" for="form-field-1">E-mail:</label>
						<div class="controls">{{ form_widget(form.email, {'attr': {'class': 'form-control'}}) }}</div>
					</div>
					<div class="control-group">			
						<label class="control-label" for="form-field-1">Nome:</label>
						<div class="controls">{{ form_widget(form.nome, {'attr': {'class': 'form-control'}}) }}</div>
					</div>	
					<div class="control-group">			
						<label class="control-label">Permissões:</label>
						<div class="controls">{{ form_widget(form.profile, {'attr': {'class': 'form-control'}}) }}</div>
					</div>				
					<div class="control-group">			
						<label class="control-label" for="form-field-1">Situação:</label>
						<div class="controls">
							{{ form_widget(form.isActive, {'attr': {'class': 'form-control'}}) }}
						</div>
					</div>
					<br/>
					<div class="control-group">			
						<label class="control-label"></label>					
						<div class="control">
							<button type="submit" class="btn btn-info">
								<i class="icon-save"></i> Salvar
							</button>
							<button type="button" class="btn btn-info" onclick="document.location.href='{% if back_action is defined %}{{ path('contracultura_user_show_profile') }}{% else %}{{ path('contracultura_user_index')}}{% endif %}';">
								<i class="icon-arrow-left"></i> Voltar 
							</button>
						</div>
					</div>					
				</form>
			</div>
		</div>
	</div>   
{% endblock %}
